<?php

namespace App\Http\Controllers;

use App\Hydrators\EgressHydrator;
use App\Models\Egress;
use App\Models\User;
use App\Repositories\Egress\EgressFilter;
use App\Repositories\Egress\EgressRepository;
use App\Repositories\User\UserFilter;
use App\Repositories\User\UserRepository;
use App\Transformers\EgressTransformer;
use App\Transformers\UserTransformer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class EgressController extends Controller
{
    public function index(EgressRepository $egressRepository, Request $request)
    {

        $paginator = $egressRepository->getPaginator(new EgressFilter($request));
        return $this->response->paginator($paginator, new EgressTransformer());
    }

    public function store()
    {
        $egress = $this->hydrate(new Egress(), new EgressHydrator());
        return $this->response()->created(null, $egress);
    }

    public function destroy($id)
    {
        Egress::destroy($id);
        return $this->response->noContent();

    }
}


